﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace hpm
{
    public partial class frmDsBenhNhan : DevExpress.XtraEditors.XtraForm
    {
        public frmDsBenhNhan()
        {
            InitializeComponent();
        }

        clsBenhNhan objBenhNhan = null;

        private void frmDsBenhNhan_Load(object sender, EventArgs e)
        {
            InitLstBenhNhan();
        }


        private void InitLstBenhNhan()
        {
            objBenhNhan = new clsBenhNhan();
            grdBenhNhan.DataSource = objBenhNhan.getAllBenhNhan1();
        }

        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            frmDangKy fDangKy = new frmDangKy();
            fDangKy.ShowDialog();
        }

        private void btnSua_Click(object sender, EventArgs e)
        {
            frmDangKy fDangKy = new frmDangKy();
            fDangKy.isEdit = true;
            try
            {
                fDangKy.MaBenhNhan = grvBenhNhan.GetFocusedRowCellValue("MaBenhNhan").ToString();
            }
            catch
            {
                MessageBox.Show("Vui lòng chọn 1 bệnh nhân trong danh sách.", "Thông báo");
                return;
            }
            fDangKy.ShowDialog();
        }

 
    }
}